<template>
  <div class="home">
    <h3>
      {{ count }}
    </h3>
    <div>
      <input v-model="params.query"/>
      <button @click="search">搜搜</button>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref, onMounted, reactive } from 'vue'
import axios from 'axios'
interface ISearch {
  query: string
}
export default defineComponent({
  setup() {
    const count = ref(100)
    const params: ISearch = reactive({
      query: ''
    })

    const search = () => {
       axios.get('https://api-hmugo-web.itheima.net/api/public/v1/goods/search', {
        params
      }).then(res => {
        console.log(res)
      })
    }
    return {
      count,
      search,
      params
    }
  }
})
</script>
